package com.webchat.user.service.relation;

import com.webchat.common.enums.AccountRelationTypeEnum;
import org.springframework.stereotype.Service;


@Service
public class User2RobotAccountRelationService extends AbstractAccountRelationService {

    @Override
    protected AccountRelationTypeEnum getRelationType() {

        return AccountRelationTypeEnum.USER_ROBOT;
    }

    @Override
    protected boolean isAsyncDoAfterComplete() {

        return true;
    }

    @Override
    protected void doAfterComplete(Long id, String sourceAccount, String targetAccount, boolean subscribe) {
        // 添加群聊到用户账号关系列表
        if (subscribe) {
            // 文件传输助手，用户注册后默认订阅，无需审核
            // 添加文件传输助手到用户好友列表缓存
            super.addTargetAccountRelationListCache(sourceAccount, targetAccount);
            // 添加文件传输助手到用户聊天对话列表缓存
            super.addTargetAccount2SourceLastChattingList(sourceAccount, targetAccount);
        }
    }
}
